% correlation coefficients by imaging time points.
% time point 1&2 and 3&4 are actually the same day.

act_site = [1 2 4 7 8];
pas_site = [3 5 6 9];

mean_act_all = {};
max_act_all = {};
for site = 1:9
    mean_act = {};
    max_act = {};
    for time_pt = 1:7
        cur_mean_act = {};
        cur_max_act = {};
        for layer = 1:4
            cur_act = proj_meta(site).rd(layer,time_pt).act;
            cur_mean_act{layer} = mean(cur_act,2);
            cur_max_act{layer} = max(cur_act,[],2);
        end
        mean_act{time_pt} = vertcat(cur_mean_act{:});
        max_act{time_pt} = vertcat(cur_max_act{:});
    end
    mean_act_all{site} = horzcat(mean_act{:});
    max_act_all{site} = horzcat(max_act{:});
    cc_mean{site} = corrcoef(mean_act_all{site});
    cc_max{site} = corrcoef(max_act_all{site});
%     figure;imagesc(cc_mean)
%     figure;imagesc(cc_max)
end

mean_cc_act = mean(cat(3,cc_mean{act_site}),3);
mean_cc_pas = mean(cat(3,cc_mean{pas_site}),3);

max_cc_act = mean(cat(3,cc_max{act_site}),3);
max_cc_pas = mean(cat(3,cc_max{pas_site}),3);

figure;imagesc(mean_cc_act)
figure;imagesc(mean_cc_pas)
figure;imagesc(max_cc_act)
figure;imagesc(max_cc_pas)